import { BASE_URL } from '@/config/public'
import { METHOD, request } from '@/utils/request'

export default {
  rqtGetRefreshToken: async params => {
    return request(`${BASE_URL}/provider/token/refresh`, METHOD.GET, params)
  },
  // 根据类型获取地区数据
  getAreaList: placeType => {
    // placeType 01-省 02-市 03-区
    return request(
      `${BASE_URL}/provider/ams/place/list/${placeType}`,
      METHOD.GET,
      {},
      { isNeedToken: false }
    )
  },
  // 根据类型和上一节点的code获取子节点
  getAreaChildrenList: (placeType, upPlaceCode) => {
    // placeType 01-省 02-市 03-区
    return request(
      `${BASE_URL}/provider/ams/place/list/${placeType}/children/${upPlaceCode}`,
      METHOD.GET,
      {},
      { isNeedToken: false }
    )
  },
  // 根据条件查询相关码值
  getDictList: params => {
    // 常用的是根据codeType查询
    return request(
      `${BASE_URL}/provider/common/defcode/list`,
      METHOD.POST_JSON_ENCRYPT,
      params,
      { isNeedToken: false }
    )
  },
  // 根据多个codeType查询
  getDictListMore: params => {
    return request(
      `${BASE_URL}/provider/common/defcode/lists`,
      METHOD.GET,
      params,
      { isNeedToken: false }
    )
  },
  getBankList: params => {
    return request(
      `${BASE_URL}/provider/ams/bank/listBank`,
      METHOD.POST_JSON_ENCRYPT,
      params
      // { isNeedToken: false }
    )
  },
  //线上产品客户告知书
  getonlineProduct: params => {
    return request(
      `${BASE_URL}/provider/ims/ejbb/online/product`,
      METHOD.GET,
      params,
      { isNeedToken: false }
    )
  },
  //附件上传接口
  upload: params => {
    return request(
      `${BASE_URL}/provider/common/attachment/file/upload`,
      METHOD.POST_FORM,
      params
    )
  },
  delFile: params => {
    return request(
      `${BASE_URL}/provider/common/attachment/batch/delete`,
      METHOD.DELETE_JSON,
      params
    )
  }
}
